package com.zhentao.subscription.domain.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDate;
import java.time.LocalDateTime;

@TableName("sub_task")
public class SubscriptionTask {
    @TableId(type = IdType.AUTO)
    private Long id;

    private String taskName;
    @TableField(exist = false)
    private Long templateId; // 模版ID - 表中不存在
    private String customsCode; // 关区代码

    private String scopeType; // 范围类型
    private String subscribeType; // 订阅类型
    private String subscribeMode; // RAW/AGG
    private String dataFormat; // CSV/TXT/EXCEL/331
    private String dataSource; // 日库/月库/发布

    private String targetSystems; // 目标系统
    private String groupFields; // 汇总字段(JSON)
    private String numericAggFields; // 数值字段聚合配置(JSON)
    private String conditions; // 统计条件(JSON)
    private String selectedFields; // 字段选择(JSON)
    private String dataRange; // 数据范围

    private String strongCheck; // 强校验
    private String status; // ACTIVE/INACTIVE/DELETED
    private String dispatchStatus; // 分发状态
    private String failLog; // 失败日志

    private LocalDate closeDateStart; // 关闭日期开始
    private LocalDate closeDateEnd; // 关闭日期结束
    private LocalDateTime lastExecuteTime; // 最后执行时间

    private String filePath; // 文件路径
    private String fileName; // 文件名

    // 实体类中有但表中没有的字段，标记为不存在
    @TableField(exist = false)
    private String scheduleType; // 调度类型：DAILY/WEEKLY/MONTHLY
    @TableField(exist = false)
    private String scheduleTime; // 调度时间
    @TableField(exist = false)
    private String scheduleCron; // Cron表达式
    @TableField(exist = false)
    private LocalDateTime lastRunTime; // 最后运行时间
    @TableField(exist = false)
    private LocalDateTime nextRunTime; // 下次运行时间

    @TableLogic
    private Integer isDelete;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;

    // Getters and Setters
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public String getTaskName() { return taskName; }
    public void setTaskName(String taskName) { this.taskName = taskName; }

    public Long getTemplateId() { return templateId; }
    public void setTemplateId(Long templateId) { this.templateId = templateId; }

    public String getCustomsCode() { return customsCode; }
    public void setCustomsCode(String customsCode) { this.customsCode = customsCode; }

    public String getSubscribeMode() { return subscribeMode; }
    public void setSubscribeMode(String subscribeMode) { this.subscribeMode = subscribeMode; }

    public String getDataFormat() { return dataFormat; }
    public void setDataFormat(String dataFormat) { this.dataFormat = dataFormat; }

    public String getDataSource() { return dataSource; }
    public void setDataSource(String dataSource) { this.dataSource = dataSource; }

    public String getGroupFields() { return groupFields; }
    public void setGroupFields(String groupFields) { this.groupFields = groupFields; }

    public String getNumericAggFields() { return numericAggFields; }
    public void setNumericAggFields(String numericAggFields) { this.numericAggFields = numericAggFields; }

    public String getConditions() { return conditions; }
    public void setConditions(String conditions) { this.conditions = conditions; }

    public String getSelectedFields() { return selectedFields; }
    public void setSelectedFields(String selectedFields) { this.selectedFields = selectedFields; }

    public String getScopeType() { return scopeType; }
    public void setScopeType(String scopeType) { this.scopeType = scopeType; }

    public String getSubscribeType() { return subscribeType; }
    public void setSubscribeType(String subscribeType) { this.subscribeType = subscribeType; }

    public String getTargetSystems() { return targetSystems; }
    public void setTargetSystems(String targetSystems) { this.targetSystems = targetSystems; }

    public String getDataRange() { return dataRange; }
    public void setDataRange(String dataRange) { this.dataRange = dataRange; }

    public String getStrongCheck() { return strongCheck; }
    public void setStrongCheck(String strongCheck) { this.strongCheck = strongCheck; }

    public String getDispatchStatus() { return dispatchStatus; }
    public void setDispatchStatus(String dispatchStatus) { this.dispatchStatus = dispatchStatus; }

    public String getFailLog() { return failLog; }
    public void setFailLog(String failLog) { this.failLog = failLog; }

    public LocalDate getCloseDateStart() { return closeDateStart; }
    public void setCloseDateStart(LocalDate closeDateStart) { this.closeDateStart = closeDateStart; }

    public LocalDate getCloseDateEnd() { return closeDateEnd; }
    public void setCloseDateEnd(LocalDate closeDateEnd) { this.closeDateEnd = closeDateEnd; }

    public LocalDateTime getLastExecuteTime() { return lastExecuteTime; }
    public void setLastExecuteTime(LocalDateTime lastExecuteTime) { this.lastExecuteTime = lastExecuteTime; }

    public String getFilePath() { return filePath; }
    public void setFilePath(String filePath) { this.filePath = filePath; }

    public String getFileName() { return fileName; }
    public void setFileName(String fileName) { this.fileName = fileName; }

    public String getScheduleType() { return scheduleType; }
    public void setScheduleType(String scheduleType) { this.scheduleType = scheduleType; }

    public String getScheduleTime() { return scheduleTime; }
    public void setScheduleTime(String scheduleTime) { this.scheduleTime = scheduleTime; }

    public String getScheduleCron() { return scheduleCron; }
    public void setScheduleCron(String scheduleCron) { this.scheduleCron = scheduleCron; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public LocalDateTime getLastRunTime() { return lastRunTime; }
    public void setLastRunTime(LocalDateTime lastRunTime) { this.lastRunTime = lastRunTime; }

    public LocalDateTime getNextRunTime() { return nextRunTime; }
    public void setNextRunTime(LocalDateTime nextRunTime) { this.nextRunTime = nextRunTime; }

    public Integer getIsDelete() { return isDelete; }
    public void setIsDelete(Integer isDelete) { this.isDelete = isDelete; }

    public LocalDateTime getCreatedTime() { return createdTime; }
    public void setCreatedTime(LocalDateTime createdTime) { this.createdTime = createdTime; }

    public LocalDateTime getUpdatedTime() { return updatedTime; }
    public void setUpdatedTime(LocalDateTime updatedTime) { this.updatedTime = updatedTime; }
}
